<?php
class Test extends Base_Controller
{
	public function __construct()
	{
		parent::__construct();
	}

    public function fenci()
	{
		$url = "http://ltpapi.voicecloud.cn/analysis/";
		$post_data = array ("api_key" => "q1e4Z7v1j9s3g9s4E2r96CRKkmyO1JFyemhv5Lfy",
				            "pattern" => "ws",
		                    "format"  => "json",
		                    "text"    => "如果在法国遇到了恐怖袭击该怎么办？");
		
		$ch = curl_init();
		
		curl_setopt($ch, CURLOPT_URL, $url);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		// post数据
		curl_setopt($ch, CURLOPT_POST, 1);
		// post的变量
		curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
		
		$output = curl_exec($ch);
		curl_close($ch);
		
	    //打印获得的数据
	    print_r($output);
	}

}